@echo off
echo Welcome to use git tool,It is made by GuHun,thanks!
pause

:BeginIgnore
::清空文件并写入第一条规则
set /p text=Which file do you want to ignore?If not, knock enter    :
if "%text%"=="" goto Step1
echo %text% > .gitignore
goto IFAdd

::多条规则执行附加语句
:AddMore
set /p text=What is more?   :
echo %text% >> .gitignore

::判断是否输入其他规则
:IFAdd
set /p flag=add more?(y / n)
if %flag% == y goto AddMore
if %flag% == n goto PrintFile
goto :IFAdd

::输出忽略文件规则
:PrintFile
for /f  %%i in (.gitignore)  do echo %%i
set /p flag=Do you want to ignore this files?(y / n)
if %flag% == y goto Step1
if %flag% == n goto BeginIgnore
goto :PrintFile

:Step1
echo Begin to init...
git init
git add *
set /p commit=What is the commit?   :
git commit -m "%commit%"

:Push
set /p flag=Do you push to master?(y / n)
if %flag% == y goto Step2
if %flag% == n goto NotMaster
goto Push

:NotMaster
set /p flag=Which branch will you to push?   :
git push origin %flag%
goto Step3

:Step2
git push origin master
set /p address=Please paste your Http or SSH   :
git remote add origin %address%

:Step3
git push -u origin master
echo Thanks for you use!!!

:End
pause